<template>
  <div class="editCont">
    <div class="edt2" @click="back">
      <img
        style="width: 29px; height: 25px; opacity: 0.5; cursor: pointer"
        src="../../assets/back.png"
      />
      <span>返回</span>
    </div>
    <div class="hx"></div>
    <div class="contss">
      <div>
        <span class="jx"><span style="margin-left: 10px">基本信息</span></span>
      </div>
      <div class="fmor">
        <el-form
          :model="infos"
          ref="infos"
          size="mini"
          label-width="150px"
          label-position="right"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item label="企业名称:">
                {{ infos.name }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="统一社会信用代码:">
                {{ infos.creditCode }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="中证码:">
                {{ infos.middleSignCode }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="所属地区:">
                {{ infos.area }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="类型:">
                {{ infos.type }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="企业所有制:">
                {{ infos.enterpriseOwnership }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="注册资本:">
                {{ infos.registerCapital }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="营业收入:">
                {{ infos.businessIncome }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="行业分类:">
                {{ infos.industryClassification }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="资产总数:">
                {{ infos.totalAssets }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="从业人数:">
                {{ infos.employeeNumber }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="规模:">
                {{ infos.scale }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="是否涉及农业:">
                {{ infos.isInvolveAgriculture }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否绿色农业:">
                {{ infos.isGreenEnterprise }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="是否科技企业:">
                {{ infos.isTechnologyEnterprise }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否民营企业:">
                {{ infos.isNongovernmentalEnterpise }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="营业开始时:">
                {{ infos.businessStartTime }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="营业结束时间:">
                {{ infos.businessEndTime }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="经营范围:">
                {{ infos.businessScope }}
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div v-if="result == 2">
          <div class="xtrz"></div>
          <div>
            <span class="jx2"
              ><span style="margin-left: 10px">经办人</span></span
            >
          </div>
          <el-form
            :model="sysEnterpriseAgentInfo"
            ref="infos"
            size="mini"
            label-width="150px"
            label-position="right"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item label="姓名:">
                  {{ sysEnterpriseAgentInfo.agentName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="居民身份证号码:">
                  {{ sysEnterpriseAgentInfo.agentIdentificationNumber }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="联系电话:">
                  {{ sysEnterpriseAgentInfo.agentPhone }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="电子邮箱:">
                  {{ sysEnterpriseAgentInfo.agentEmail }}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div v-if="result == 2">
          <div class="xtrz"></div>
          <div>
            <span class="jx2"
              ><span style="margin-left: 10px">法人信息</span></span
            >
          </div>
          <el-form
            :model="sysEnterpriseCorporationInfo"
            ref="infos"
            size="mini"
            label-width="150px"
            label-position="right"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item label="姓名:">
                  {{ sysEnterpriseCorporationInfo.corporationName }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="国籍:">
                  {{ sysEnterpriseCorporationInfo.corporationNationality }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="证件类型:">
                  {{ sysEnterpriseCorporationInfo.credentialsType }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="证件号码:">
                  {{ sysEnterpriseCorporationInfo.credentialsNumber }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="证件签发日:">
                  {{ sysEnterpriseCorporationInfo.credentialsSignTime }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="证件到期日:">
                  {{ sysEnterpriseCorporationInfo.credentialsExpireTime }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="证件签发城市:">
                  {{ sysEnterpriseCorporationInfo.credentialsSignCity }}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="anniu">
          <el-button
            type="primary"
            @click="gengduo"
            v-if="result == 0 || result == 1"
            >查看更多</el-button
          >
          <!-- <el-button type="primary" @click="kehusx(infos)">授信</el-button> -->
          <el-button type="primary" @click="creditReject">拒绝</el-button>
        </div>
      </div>
    </div>
    <div class="tk">
      <el-dialog
        title=""
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
      >
        <div>
          <div v-if="result == 0">
            <div class="neir3">向企业提出申请查看更多详细信息</div>
            <span
              slot="footer"
              class="dialog-footer"
              style="margin-left: 168px"
            >
              <el-button @click="dialogVisible = false">取 消</el-button>
              <el-button type="primary" @click="addAuthorizationApplys"
                >确 定</el-button
              >
            </span>
          </div>
          <div v-if="result == 1">
            <div class="neir3">企业正在审批中</div>
            <span
              slot="footer"
              class="dialog-footer"
              style="margin-left: 168px"
            >
              <el-button @click="dialogVisible = false">取 消</el-button>
              <el-button type="primary" @click="dialogVisible = false"
                >确 定</el-button
              >
            </span>
          </div>
          <div v-if="result == 2">
            <div class="neir3">企业审批完成 直接查看更多企业信息</div>
            <span
              slot="footer"
              class="dialog-footer"
              style="margin-left: 168px"
            >
              <el-button @click="dialogVisible = false">取 消</el-button>
              <el-button type="primary">确 定</el-button>
            </span>
          </div>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import {
  editWorks,
  getEnterpriseInfoDet,
  makeAuthPdf,
  addAuthorizationApply,
  creditReject,
} from "@/api/leagues/app";

export default {
  name: "",
  components: {
    ElImageViewer,
  },
  data() {
    return {
      dialogVisible: false,
      billInfo: {},
      transInfo: {},
      formrenz: {},
      infos: {},
      imgUrl: "",
      imgList: [],
      result: "",
      sysEnterpriseAgentInfo: {
        agentName: "",
        agentIdentificationNumber: "",
        agentPhone: "",
        agentEmail: "",
      },
      sysEnterpriseCorporationInfo: {
        credentialsSignCity: "",
        credentialsExpireTime: "",
        credentialsSignTime: "",
        credentialsNumber: "",
        credentialsType: "",
        corporationNationality: "",
        corporationName: "",
      },
    };
  },
  //方法集合
  created() {
    // this.getEdit();
    this.getkehuInfos();
  },
  methods: {
    getEdit() {
      console.log(this.$route.query, "this.$route.query");
      let editRowId = this.$route.query.id;
      editWorks(editRowId)
        .then((response) => {
          console.log(response.data.data.billInfo, "response");
          this.billInfo = response.data.data.billInfo;
          this.transInfo = response.data.data.transInfo;
        })
        .catch(() => {});
    },

    creditReject() {
      let extraCreditApplyId = this.$route.query.id;
      creditReject(extraCreditApplyId)
        .then((response) => {
          if (response.data.code == 0) {
            this.$message({
              message:response.data.data,
            });
          }
          console.log(response.data.data, "response");
        })
        .catch(() => {});
    },

    getkehuInfos() {
      let enterpriseId = this.$route.query.id;
      var that = this;
      getEnterpriseInfoDet(enterpriseId)
        .then((data) => {
          this.infos = data.data.data.sysEnterpriseBaseInfo;
          this.sysEnterpriseAgentInfo =
            data.data.data.sysEnterpriseAgentInfo ||
            this.sysEnterpriseAgentInfo;
          this.sysEnterpriseCorporationInfo =
            data.data.data.sysEnterpriseCorporationInfo ||
            this.sysEnterpriseCorporationInfo;
          this.bankId = data.data.data.sysEnterpriseBaseInfo.bankId;
          this.result = data.data.data.result;
          //  that.$message({
          //   duration:600,
          //   message:'查询成功',
          //   type:'success'
          // })
        })
        .catch((error) => {
          console.log(error);
        });
    },
    addAuthorizationApplys() {
      let enterpriseId = this.$route.query.id;
      var that = this;
      addAuthorizationApply(
        Object.assign({
          enterpriseId: enterpriseId,
          bankId: this.bankId,
        })
      )
        .then((data) => {
          that.$message.success(data.data.msg);
          this.dialogVisible = false;
          this.getkehuInfos();
        })
        .catch((error) => {
          console.log(error);
        });
    },
    back() {
      this.$router.go(-1);
    },
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    gengduo() {
      this.dialogVisible = true;
    },

    editba() {
      this.$router.push({ name: "editUser" });
    },
    kehusx(item) {
      debugger
      this.extraCreditApplyId=this.$route.query.id2
      this.$router.push({
        name: "creditLimit",
        query: {
          item: item,
          extraCreditApplyId:this.extraCreditApplyId
        },
      });
    },
  },
};
</script>
<style  scoped>
.edt2 {
  float: left;
  height: 24px;
  font-size: 25px;
  font-weight: bold;
  color: #051232;
  line-height: 54px;
  margin-left: 10px;
}
.edt1 {
  height: 24px;
  font-size: 25px;
  font-weight: bold;
  color: #051232;
  line-height: 54px;
  float: right;
  margin-right: 11px;
}
.jx {
  width: 2px;
  height: 20px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 100px;
  text-indent: 20px;
  border-left: 3px solid #0075ff;
  margin-left: 40px;
}
.neir {
  width: 300px;
  height: 15px;
  font-size: 16px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 35px;
  margin-bottom: 30px;
}
.neir3 {
  width: 300px;
  height: 68px;
  font-size: 16px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  /* line-height: 35px;
margin-bottom: 30px; */
  margin-left: 100px;
  text-align: center;
}
.jx2 {
  width: 2px;
  height: 20px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 100px;
  text-indent: 20px;
  border-left: 3px solid #0075ff;
  margin-left: -47px;
}
.pj {
  height: 84px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
  display: flex;
  margin-left: 94px;
}
.fmor {
  position: relative;
  margin-left: 93px;
}
.editCont {
  width: 1200px;
  /* height: 890px; */
  background: #ffffff;
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.06);
  border-radius: 6px 6px 10px 10px;
  margin: 0 auto;
  position: relative;
  top: 50%;
}
.hx {
  width: 1200px;
  height: 54px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
}
.hx2 {
  width: 1200px;
  height: 54px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
  margin-top: 181px;
}
.lzp {
  margin-left: 10px;
}
.sx {
  width: 2px;
  height: 20px;
  background: #0075ff;
}
.sxzt {
  height: 17px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #051232;
  line-height: 10px;
  margin-left: 10px;
  margin-top: 5px;
}
.xtrz {
  width: 1100px;
  height: 84px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0px 1px 0px 0px #e6e6e6;
  margin-left: -51px;
}
.tag {
  width: 63px;
  height: 26px;
  border: 2px solid #15be6b;
  position: relative;
  background-color: #15be6b;
  margin-left: 119px;
  margin-top: -52px;
}
.tag:before,
.tag:after {
  content: "";
  display: block;
  border-width: 7px;
  position: absolute;
  bottom: -16px;
  left: -1px;
  border-style: solid dashed dashed;
  border-color: #15be6b transparent transparent;
  font-size: 0;
  line-height: 0;
}
/* .tag:after {
  bottom: -33px;
  border-color: #fff transparent transparent;
} */
.tag span {
  width: 35px;
  height: 12px;
  font-size: 12px;
  font-weight: 400;
  color: #ffffff;
  line-height: 23px;
  padding-left: 7px;
}
.anniu {
  text-align: center;
  padding-bottom: 50px;
}
.lfwz {
  height: 14px;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #586279;
  line-height: 36px;
  margin-top: 57px;
  margin-left: 85px;
}
.lfwzsp {
  display: inline-block;
  width: 80px;
  text-align: right;
}

.rgftu {
  float: right;
  display: inline-flex;
  margin-right: 225px;
  margin-top: -19px;
}
.jywz {
  height: 13px;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #586279;
  line-height: 56px;
  margin-left: 70px;
}
.jycts {
  display: flex;
  margin-top: 13px;
}
</style>
